<template>
  <view class="wrap" :style="{height:screenHeight+'px'}">
    <top-tab tabTitle="我的下级" @backClick="backClick" backColor="#5B2177"/>
		<view class="level-code-table">
					<uni-table border stripe emptyText="暂无更多数据" >
					    <!-- 表头行 -->
					    <uni-tr>
					        <uni-th align="center" width="35">ID</uni-th>
					        <uni-th align="center" width="35">昵称</uni-th>
					        <uni-th align="center" width="55">充值金额</uni-th>
									<uni-th align="center" width="37">佣金</uni-th>
									<uni-th align="center" width="42">注册时间</uni-th>
					    </uni-tr>
					    <!-- 表格数据行 -->
					    <uni-tr v-for="(item,index) in tabData" :key="item.id">
					        <uni-td>{{item.id}}</uni-td>
					        <uni-td>{{item.nick}}</uni-td>
					        <uni-td>{{item.tioupMoney}}</uni-td>
									<uni-td>{{item.rechargeAmount}}</uni-td>
									<uni-td>{{item.rewardAmount}}</uni-td>
					    </uni-tr>
					</uni-table>
		</view>
  </view>
</template>

<script>
	import topTab from '@/components/top-tabbar.vue'
	import { $POST, $GET } from '@/network/api.js'
	import { formatDate } from '@/network/date.js'
  export default {
		components: { topTab },
    data() {
      return {
				screenHeight: uni.getSystemInfoSync().screenHeight, // 屏幕高度
				tabData: [
					// { id: 41411, name: '荆州荆州', tioupMoney: '2000.00', brokerage: '100.00', tiem: '2021-9-1 16:24'},
					// { id: 21441, name: '幽州荆州', tioupMoney: '2000.00', brokerage: '59', tiem: '2021-8-31'},
					// { id: 34141, name: '冀州冀州', tioupMoney: '2000.00', brokerage: '199.00', tiem: '2021-8-30'},
					// { id: 44141, name: '山东山东', tioupMoney: '2000.00', brokerage: '10', tiem: '2021-8-29'},
					// { id: 51414, name: '徐州山东', tioupMoney: '2000.00', brokerage: '788.00', tiem: '2021-8-28'}
				],
			}
    },
  onLoad() {
		this.getMyLevel()
	},
  methods: {
		// 下级列表
		async getMyLevel() {
			const res = await $GET("/boke-user/user/subordinates")
			res.data.forEach(item => {
				item.createTime = formatDate(item.createTime)
			})
			this.tabData = res.data
		},
		// 返回上一页
		backClick() {
			uni.navigateBack({
				
			})
		}
	}
}
</script>

<style lang="scss" scoped>
	.wrap{
		background: #F2F2F2;
		.level-code-table{
			margin-top: 30rpx;
			/deep/ .uni-table-th {
				height: 89rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #333333;
				box-sizing: border-box;
				padding: 0 !important;
				line-height: 89rpx;
			}
			 /deep/ .uni-table {
					table-layout:fixed;
				}
			/deep/ .uni-table-td {
				font-size: 24rpx;
				padding: 8rpx 0 !important;
				text-align: center !important;
				word-wrap:break-word;
				text-align:center;
				white-space:pre-line;
				word-wrap:break-word;
				word-break:break-all
			}
		}
	}
</style>
